%Compute equivalent variation for a given default and normative relevance
%of costs

function[value]=ev(gamma,alpha,rho,t,m,maxmatch,d,maxcont,pi)

u_optout = utility_optout(gamma,alpha,rho,t,m,maxmatch,maxcont);
u_optin = utility_optin(alpha,rho,t,m,maxmatch,d);
optout_flag = (u_optout>u_optin);

evaluated_costs = gamma*pi;

value = (ev_optout(0,evaluated_costs,alpha,rho,t,m,maxmatch,maxcont).*(optout_flag))...
    + (ev_optin(0,alpha,rho,t,m,maxmatch,d,maxcont).*(1-optout_flag));

end

